import { create } from "zustand";

const useStore = create<{
  list: string[];
  addList: (message: string) => void;
  removeList: (index: number) => void;
}>((set) => ({
  list: [],
  addList: (message: string) =>
    set((state) => ({ list: [...state.list, message] })),
  removeList: (index: number) =>
    set((state) => {
      const list = state.list.filter((_, i) => i !== index);
      return { list };
    }),
}));
